package com.mjh.partners.utils;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMVCConfigure implements  WebMvcConfigurer {
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		List<String> paths=new ArrayList<>();
		paths.add("/ExperiecneCotroller/getAllExperience");
		paths.add("/ViewController/goUserPanel");
		paths.add("/ViewController/toRegister");
		paths.add("/UserController/doLogin");
		paths.add("/UserController/saveHead");
		paths.add("/ViewController/toLogin");
		paths.add("/ViewController/toRegister");
		paths.add("/UserController/registerUser");
		paths.add("/ViewController/toDetailed");
		paths.add("/ViewController/goAbout");
		paths.add("/ExperiecneCotroller/getExperienceByEid");
		paths.add("/CommentController/getAllCommentByEid");
		paths.add("//UserController/CheckUserid");
		paths.add("/Partners/picture132/**");
		paths.add("/css/**");
		paths.add("/js/**");
		paths.add("/image/**");
		registry.addInterceptor(new CheckUserInterceptor()).addPathPatterns("/**").excludePathPatterns(paths);
	}
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/Partners/picture132/**").addResourceLocations("file:c:/picture132/");
	}
}
